package cn.hpclub.server.model;

import java.io.Serializable;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jfinal.ext.plugin.tablebind.TableBind;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Record;

import cn.hpclub.server.constant.H5ApiConstant;

/**
 * 实体类 - 地市数据
 * 
 */
@TableBind(tableName = "cmcc_area")
public class CmccArea extends Model<CmccArea> implements Serializable{
    private static final Logger  logger           = LoggerFactory.getLogger(CmccArea.class);
    private static final long    serialVersionUID = 5108597504836776213L;
    public static final CmccArea dao              = new CmccArea();

    public static final String   REGION_ID        = "region_id";
    public static final String   AREA_CODE        = "area_code";
    public static final String   AREA_NAME        = "area_name";

    /**
     * @Title: findAreaByRegionId
     * @Description:TODO
     * @param int1
     * @return List<Record>
     */
    public List<Record> findAreaByRegionId(int regionId){
        String sql = "select area_code as code,area_name as name, company_name as company from "
                + H5ApiConstant.Table.CMCC_AREA + " where " + REGION_ID + "=?";
        return Db.find(sql, new Object[] { regionId });
    }

}
